<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="特殊价格信息管理">
    <#if (goodsId)??>
        <#assign isEdit = true />
    <#else>
        <#assign isAdd = true />
    </#if>



<body class="input">

<script type="text/javascript">

    $().ready(function () {
        var $validateErrorContainer = $("#validateErrorContainer");
        var $validateErrorLabelContainer = $("#validateErrorContainer ul");
        var $validateForm = $("#inputForm");
        var $tab = $("#tab");
        // Tab效果
        $tab.tabs(".tabContent", {
            tabs:"input"
        });

        // 表单验证
        $validateForm.validate({
            errorContainer:$validateErrorContainer,
            errorLabelContainer:$validateErrorLabelContainer,
            wrapper:"li",
            errorClass:"validateError",
            ignoreTitle:true,
            rules:{
                "gameSpecialPrice.templateName":{
                    required:true
                }

            },
            messages:{
                "gameSpecialPrice.templateName":{
                    required:"请选择价格模版名称！！"
                }

            },
            submitHandler:function (form) {
                $(form).find(":submit").attr("disabled", true);
                form.submit();
            }
        });

        <#if actionErrors??&&(actionErrors?size > 0)>
            $.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
                modal: true, autoCloseTime: 3000});
        </#if>
    });

        function check1() {
            $("#priceSpan").html('');
            var e = /^(([1-9]\d*)|\d)(\.\d{1,3})?$/;
            var blsx = $("#price").val();
            if (!e.test(blsx)) {
                $("#priceSpan").html('价格格式不正确！(例：0.000)');
                return false;
            }
            else {
                return true;
            }
        }

</script>

<div class="body">
    <div class="inputBar">
        <h1><span class="icon">&nbsp;</span><#if isAdd??>设置特殊价格体系<#else>编辑特殊价格体系</#if></h1>
    </div>
    <div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
        <div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
        <ul></ul>
    </div>
    <form id="inputForm" class="validate"
          action="<#if isAdd??>${web_base}/game/game_special_price!save.htm<#else>${web_base}/game/game_special_price!edit.htm</#if>"
          method="post">
        <input type="hidden" name="goodId" value="${goodId!}" />
        <input type="hidden" name="tempCode" value="${tempCode!}" />
        <input type="hidden" name="templateName" value="${templateName!}" />
        <input type="hidden" name="brandName" value="${brandName!}" />
        <ul class="tab">
            <li>
                <input type="button" value="基本信息" hidefocus="true"/>
            </li>
        </ul>
        <table class="inputTable tabContent">
            <tr style="display: none;">
                <th>
                    id:
                </th>
                <td id="id">
                    <input type="hidden" name="gameSpecialPrice.id" class="formText {required: false}"
                           value="${(gameSpecialPrice.id)!}"/>
                </td>
            </tr>
            <#if isAdd??>
                <tr>
                    <th>
                        模板名称：
                    </th>
                    <td>
                        <select name="gameSpecialPrice.templateName" class="formText {required: true}"
                                id="templateName">
                            <option value="" selected="selected">
                                请选择模板名称
                            </option>
                            <#if gamePriceTemplate??>
                                <#list gamePriceTemplate as obj>
                                    <option value="${obj!}">${obj!}</option>
                                </#list>
                            </#if>
                        </select>
                        <label class="requireField">*</label>

                    </td>
                </tr>
                <tr>
                    <th>
                        价格利率：
                    </th>
                    <td>
                        <input type="text" name="gameSpecialPrice.priceRatio" class="formText {required: false}"
                               value="" onkeyup="this.value=this.value.replace(/\D/g,'')"
                               onafterpaste="this.value=this.value.replace(/\D/g,'')"/>‰
                    </td>
                </tr>
            <#else >
                <tr>
                    <th>
                        模板名称:
                    </th>
                    <td>
                    ${(gameSpecialPrice.templateName)!}
                        <input type="hidden" name="gameSpecialPrice.templateName" class="formText {required: false}"
                               value="${(gameSpecialPrice.templateName)!}" />
                    </td>
                </tr>
            </#if>

            <#if !isAdd??>
                <tr>
                    <th>
                        商品编号:
                    </th>
                    <td>
                    ${(gameSpecialPrice.goodsId)!}
                        <input type="hidden" name="gameSpecialPrice.goodsId" class="formText {required: false}"
                               value="${(gameSpecialPrice.goodsId)!}" />
                    </td>
                </tr>
                <tr>
                    <th>
                        商品名称:
                    </th>
                    <td>
                    ${(gameSpecialPrice.goodsName)!}
                        <input type="hidden" name="gameSpecialPrice.goodsName" class="formText {required: false}"
                               value="${(gameSpecialPrice.goodsName)!}" />
                    </td>
                </tr>
            </#if>


            <#if !isAdd??>
                <tr>
                    <th>
                        售价(元):
                    </th>
                    <td>
                        <input id="price" name="inPrice" type="text" class="formText {required: true}" onblur="check1()"
                               value='${(gameSpecialPrice.inPrice*1.0/1000)?string("0.000")!}' />
                        <label class="requireField">*</label>
                        <span id="priceSpan" style="color: red;"></span>
                    </td>
                </tr>
            </#if>

        </table>
        <div class="buttonArea">
            <input type="submit" class="formButton"  <#if isAdd??> value="设  置" <#else>
                   value="更  新"</#if>hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回"
                   hidefocus="true"/>
        </div>
    </form>
</div>
</body>
</@edit>
